package tcln.sors.client.core.mvc;

/**
 * Notification data for model data 'change' nodification.
 * 
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public class ModelDataNotification {

    /**
     * Nodifying model data property.
     */
    private String property;

    /**
     * Old value (before changes).
     */
    private Object oldValue;

    /**
     * New value (after changes).
     */
    private Object newValue;

    /**
     * Sets model data property.
     * 
     * @param property
     * @return
     */
    public ModelDataNotification forProperty(String property) {
        this.property = property;
        return this;
    }

    /**
     * Sets old value.
     * 
     * @param oldValue
     * @return
     */
    public ModelDataNotification fromValue(Object oldValue) {
        this.oldValue = oldValue;
        return this;
    }

    /**
     * Set new value.
     * 
     * @param newValue
     * @return
     */
    public ModelDataNotification toValue(Object newValue) {
        this.newValue = newValue;
        return this;
    }

    /**
     * Returns current value of {@link #property}.
     * 
     * @return the {@link #property}.
     */
    public String getProperty() {
        return property;
    }

    /**
     * Returns current value of {@link #oldValue}.
     * 
     * @return the {@link #oldValue}.
     */
    public Object getOldValue() {
        return oldValue;
    }

    /**
     * Returns current value of {@link #newValue}.
     * 
     * @return the {@link #newValue}.
     */
    public Object getNewValue() {
        return newValue;
    }
}
